
	function toggleView(id) { 
		var commentDIV = 'comment'+id;
		var textDIV = 'text'+id;
		var headDIV = 'head'+id;
		if (document.getElementById(commentDIV).style.display == "none"){
			document.getElementById(commentDIV).style.display = 'block';
			document.getElementById(headDIV).style.display = 'none';
		} else {
			document.getElementById(commentDIV).style.display = 'none';			
			document.getElementById(headDIV).style.display = 'block';
		}
	}	
	
	function togglePass() { 
		if (document.getElementById("passID").style.display == "none"){
			document.getElementById("passLink").style.display = 'none';
			document.getElementById("passID").style.display = 'block';
		} else {
			document.getElementById("passID").style.display = 'none';			
			document.getElementById("passLink").style.display = 'block';
		}
	}		

	function boldify() { 
		var text = document.getElementById('post').value;
		var btext = prompt("Enter the text you want bolded","")
		document.getElementById('post').innerHTML = text + "[b]" + btext + "[/b]"; 
		document.getElementById('post').focus(); 
	}
	
	function italify() { 
		var text = document.getElementById('post').value;
		var btext = prompt("Enter the text you want italicized","")
		document.getElementById('post').innerHTML = text + "[i]" + btext + "[/i]"; 
		document.getElementById('post').focus(); 
	}
	
	function underlinify() { 
		var text = document.getElementById('post').value;
		var btext = prompt("Enter the text you want underlined","")
		document.getElementById('post').innerHTML = text + "[u]" + btext + "[/u]"; 
		document.getElementById('post').focus(); 
	}
	
	function linkify() { 
		var text = document.getElementById('post').value;
		var lval = prompt("Enter the link","http://")
		var ltext = prompt("Enter the link title","");
		document.getElementById('post').innerHTML = text + "[[" + lval + "|" + ltext + "]]"; 
		document.getElementById('post').focus(); 
	}
	
	function imagify() { 
		var text = document.getElementById('post').value;
		var imgval = prompt("Enter the path to the image","")
		var alttext = prompt("Enter the alternate text (optional)","")
		document.getElementById('post').innerHTML = text + "<img src=\"" + imgval + "\" alt=\"" + alttext + "\" />"; 
		document.getElementById('post').focus(); 
	}	
	
	function captcha_warning() { 
		alert("You did not correctly confirm the text in the image.  Please try again."); 
	}

	function tag_search() { 
		var tag = document.getElementById('q').value;
		location.href='/blog.php/tagsearch/'+tag; 
	}
	
	
	function boldify2(i) { 
		var text 	= document.getElementById(i).value;
		var obj 	= document.getElementById(i);
		var btext = prompt("Enter the text you want bolded","")
		obj.innerHTML = text + " [b]" + btext + "[/b]"; 
		obj.focus(); 
	}

	function italify2(i) { 
		var text 	= document.getElementById(i).value;
		var obj 	= document.getElementById(i);
		var itext = prompt("Enter the text you want italicized","")
		obj.innerHTML = text + " [i]" + itext + "[/i]"; 
		obj.focus(); 
	}
	
	function underlinify2(i) { 
		var text 	= document.getElementById(i).value;
		var obj 	= document.getElementById(i);
		var utext = prompt("Enter the text you want underlined","")
		obj.innerHTML = text + " [u]" + utext + "[/u]"; 
		obj.focus();  
	}
	
	function linkify2(i) { 
		var text 	= document.getElementById(i).value;
		var obj 	= document.getElementById(i);
		var lval = prompt("Enter the link","http://")
		var ltext = prompt("Enter the link title","");
		obj.innerHTML = text + " [[" + lval + "|" + ltext + "]]"; 
		obj.focus(); 
	}
	
	function imagify2(i) { 
		var text 	= document.getElementById(i).value;
		var obj 	= document.getElementById(i);
		var imgval = prompt("Enter the path to the image","")
		var alttext = prompt("Enter the alternate text (optional)","")
		obj.innerHTML = text + "<img src=\"" + imgval + "\" alt=\"" + alttext + "\" />"; 
		obj.focus(); 
	}	

    function createCookie(name,value,days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
        } else { 
	       var expires = "";
        }
	   document.cookie = name+"="+value+expires+"; path=/";
    }

    function clearFormCookies() { 
        var fName = document.getElementById('nameid'); 
        var fContact = document.getElementById('contactid');
        var fRemember = document.getElementById('rememberid');
        createCookie('flip_name','',-1);
        createCookie('flip_contact','',-1); 
        fName.value='';
        fContact.value=''; 
        fRemember.style.display='none'; 
        alert("You have been logged out"); 
    }

	function toggle_body() { 
		var bodymesg = document.getElementById('add_item_body_collapsed');
		var bodytext = document.getElementById('add_item_body');	
		if(bodymesg.style.display=="block") { 
			bodytext.style.display='block';
			bodymesg.style.display='none';
		} else { 
			bodymesg.style.display='block';
			bodytext.style.display='none';		
		}
	}	
	
	function topicSwap() { 
		var tid	= document.getElementById('topic_id');
		var ren = document.getElementById('topic_rename');
		ren.value=tid.options[tid.selectedIndex].innerHTML; 
		return true; 
	}
	
	function confirm_delete_topic() { 
		var tdel = document.getElementById("topic_delete"); 
		if(tdel.clicked) { 
			return confirm("Are you sure you want to delete this topic?\n\nThis is a permanent action and cannot be undone!");
		} else {
			return true; 
		}
	}
	
	function placeTag(node,tag) { 
		var nodename = "tag_"+node; 
		document.getElementById(nodename).value=tag; 
		var searchnodename = "tagsearch_"+node; 
		document.getElementById(searchnodename).style.display="none"; 	
	}
	
	function checkTag() { 
		var illegalChars = /\W\s/; // allow only letters, numbers, and underscores
		if (illegalChars.test(thistag)) {
			alert("Tags can only contain letters, numbers, and underscores!");		
			return FALSE; 
		} 
	}
	
	function hideNode(node) { 
		document.getElementById(node).style.display="none"; 		
	}
	
	tagseed = 1; 
	function moreTags() { 
		if(tagseed <= 20) {  
			var mydiv = document.getElementById('moretags');
			var newdiv = document.createElement('div');
			var nodename = "tag_"+tagseed; 
			newdiv.setAttribute('id',nodename);
			if(tagseed<20) { 
				newdiv.innerHTML="<input type=\"text\" id=\"tag_"+tagseed+"\" name=\"tags[]\" size=\"20\""  
				+ "class=\"text_input\" onkeydown=\"tagSuggest('"+tagseed+"',event)\" "
				+ "onblur=\"hideNode('tagsearch_"+tagseed+"')\" /> <small><a href=\"javascript:removeNode('"
				+ nodename+"')\">remove</a></small><br /><div id=\"tagsearch_"+tagseed+"\" "
				+ "class=\"tagsearch\" style=\"display:inline\"></div>\n";
			} 
			tagseed++; 
			mydiv.appendChild(newdiv); 
		} else { 
			var more = document.getElementById('morelink'); 
			more.style.visibility="hidden"; 
		}
	}	
	

	uploadseed=1; 
	function moreUploads() { 
		if(uploadseed <= 12) {  
			var mydiv = document.getElementById('moreuploads');
			var newdiv = document.createElement('div');
			var nodename = "upload_"+uploadseed; 
			newdiv.setAttribute('id',nodename);
			if(uploadseed<12) { 
				newdiv.innerHTML="<input type=\"file\" name=\"upload[]\" size=\"50\" class=\"text_input\" /> "
				+ "<small><a href=\"javascript:removeNode('"+nodename+"')\">remove</a></small><br />";
			} else { 
				newdiv.innerHTML="<span style=\"margin-top:10px;font-weight:bold;\">"
					+ "Sorry: The maximum is 12 concurrent uploads!</span><br />";		
			} 
			uploadseed++; 
			mydiv.appendChild(newdiv); 
		} else { 
			var more = document.getElementById('morelink'); 
			more.style.visibility="hidden"; 
		}
	}
	
	function removeNode(nodeid) { 
		var node = document.getElementById(nodeid);
		node.parentNode.removeChild(node);	
	}
	
	function showUploads(o) { 
		var mydiv = document.getElementById('uploadfieldset'); 
		mydiv.innerHTML = '<img src="./smallaxe_icons/loading.gif" alt="Loading..." align=\"middle\" /> Loading...';
		var subURL 	= "./inc/modules/admin-ajax.php?op=uploads&offset="+o;
		xmlhttp.open("GET",subURL,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				mydiv.innerHTML = xmlhttp.responseText; 
			}
		}
		//if(success != 1) { alert("ERROR: Failed to add tag(s)"); }		
		xmlhttp.send(null);	
	}
	
	function toggleEXIF(k) { 
		exif = document.getElementById('exif_'+k); 
		if(exif.style.display=="none") { 
			exif.style.display="block";
			exif.style.className="fullfielset"; 
		} else { 
			exif.style.display="none"; 
			exif.style.className="collapsedfieldset"; 
		}
	}